package org.example.service.serviceImpl;

import org.example.entity.Report;
import org.example.mapper.EmpMapper;
import org.example.mapper.ReportMapper;
import org.example.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ReportServiceImpl implements ReportService {
    @Autowired
    EmpMapper empMapper;
    @Override
    public Report countQuantityByJob() {
        List<Map<String, Object>> maps = empMapper.countByJob();
        List<Object> pos = maps.stream().map(m -> m.get("pos")).toList();
        List<Object> total = maps.stream().map(m -> m.get("total")).toList();
        return new Report(total,pos);

    }

    @Override
    public List<Map> getEmpGenderData() {
        return empMapper.countEmpGenderData();
    }
}
